Optimal. Leaf size=58 \[ -2 a b x-\frac {2 a b \cot (c+d x)}{d}-\frac {a^2 \cot ^2(c+d x)}{2 d}-\frac {\left (a^2-b^2\right ) \log (\sin (c+d x))}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.07, antiderivative size = 58, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3623, 3610,
3612, 3556} \begin {gather*} -\frac {\left (a^2-b^2\right ) \log (\sin (c+d x))}{d}-\frac {a^2 \cot ^2(c+d x)}{2 d}-\frac {2 a b \cot (c+d x)}{d}-2 a b x \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3610
Rule 3612
Rule 3623
Rubi steps
\begin {align*} \int \cot ^3(c+d x) (a+b \tan (c+d x))^2 \, dx &=-\frac {a^2 \cot ^2(c+d x)}{2 d}+\int \cot ^2(c+d x) \left (2 a b-\left (a^2-b^2\right ) \tan (c+d x)\right ) \, dx\\ &=-\frac {2 a b \cot (c+d x)}{d}-\frac {a^2 \cot ^2(c+d x)}{2 d}+\int \cot (c+d x) \left (-a^2+b^2-2 a b \tan (c+d x)\right ) \, dx\\ &=-2 a b x-\frac {2 a b \cot (c+d x)}{d}-\frac {a^2 \cot ^2(c+d x)}{2 d}+\left (-a^2+b^2\right ) \int \cot (c+d x) \, dx\\ &=-2 a b x-\frac {2 a b \cot (c+d x)}{d}-\frac {a^2 \cot ^2(c+d x)}{2 d}-\frac {\left (a^2-b^2\right ) \log (\sin (c+d x))}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.30, size = 92, normalized size = 1.59 \begin {gather*} \frac {-4 a b \cot (c+d x)-a^2 \cot ^2(c+d x)+(a+i b)^2 \log (i-\tan (c+d x))-2 (a-b) (a+b) \log (\tan (c+d x))+(a-i b)^2 \log (i+\tan (c+d x))}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.20, size = 61, normalized size = 1.05
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {\left (\cot ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\sin \left (d x +c \right )\right )\right )+2 a b \left (-\cot \left (d x +c \right )-d x -c \right )+b^{2} \ln \left (\sin \left (d x +c \right )\right )}{d}\) | \(61\) |
default | \(\frac {a^{2} \left (-\frac {\left (\cot ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\sin \left (d x +c \right )\right )\right )+2 a b \left (-\cot \left (d x +c \right )-d x -c \right )+b^{2} \ln \left (\sin \left (d x +c \right )\right )}{d}\) | \(61\) |
norman | \(\frac {-\frac {a^{2}}{2 d}-2 a b x \left (\tan ^{2}\left (d x +c \right )\right )-\frac {2 a b \tan \left (d x +c \right )}{d}}{\tan \left (d x +c \right )^{2}}-\frac {\left (a^{2}-b^{2}\right ) \ln \left (\tan \left (d x +c \right )\right )}{d}+\frac {\left (a^{2}-b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) | \(92\) |
risch | \(-2 a b x +i a^{2} x -i b^{2} x +\frac {2 i a^{2} c}{d}-\frac {2 i b^{2} c}{d}+\frac {2 a \left (a \,{\mathrm e}^{2 i \left (d x +c \right )}-2 i b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 i b \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}-\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) b^{2}}{d}\) | \(128\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 78, normalized size = 1.34 \begin {gather*} -\frac {4 \, {\left (d x + c\right )} a b - {\left (a^{2} - b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (a^{2} - b^{2}\right )} \log \left (\tan \left (d x + c\right )\right ) + \frac {4 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.19, size = 86, normalized size = 1.48 \begin {gather*} -\frac {{\left (a^{2} - b^{2}\right )} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right )^{2} + 4 \, a b \tan \left (d x + c\right ) + {\left (4 \, a b d x + a^{2}\right )} \tan \left (d x + c\right )^{2} + a^{2}}{2 \, d \tan \left (d x + c\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 131 vs.
\(2 (53) = 106\).
time = 0.68, size = 131, normalized size = 2.26 \begin {gather*} \begin {cases} \tilde {\infty } a^{2} x & \text {for}\: \left (c = 0 \vee c = - d x\right ) \wedge \left (c = - d x \vee d = 0\right ) \\x \left (a + b \tan {\left (c \right )}\right )^{2} \cot ^{3}{\left (c \right )} & \text {for}\: d = 0 \\\frac {a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - \frac {a^{2} \log {\left (\tan {\left (c + d x \right )} \right )}}{d} - \frac {a^{2}}{2 d \tan ^{2}{\left (c + d x \right )}} - 2 a b x - \frac {2 a b}{d \tan {\left (c + d x \right )}} - \frac {b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {b^{2} \log {\left (\tan {\left (c + d x \right )} \right )}}{d} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 154 vs.
\(2 (56) = 112\).
time = 0.84, size = 154, normalized size = 2.66 \begin {gather*} -\frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 16 \, {\left (d x + c\right )} a b - 8 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 8 \, {\left (a^{2} - b^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right ) + 8 \, {\left (a^{2} - b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - \frac {12 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 8 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2}}}{8 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.01, size = 97, normalized size = 1.67 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,{\left (a+b\,1{}\mathrm {i}\right )}^2}{2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,{\left (b+a\,1{}\mathrm {i}\right )}^2}{2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (a^2-b^2\right )}{d}-\frac {{\mathrm {cot}\left (c+d\,x\right )}^2\,\left (\frac {a^2}{2}+2\,b\,\mathrm {tan}\left (c+d\,x\right )\,a\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________